home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Collection of Tools & Utilities
/
Collection of Tools and Utilities.iso
/
basic
/
qbwinfnt.zip
/
FILEINFO.BAS
< prev
next >
Wrap
BASIC Source File
|
1994-03-01
|
22KB
|
526 lines
REM: FILEINFO.BAS, Unregistered Version 1.0
REM: Routines to display info on FNT files or resource files.
DECLARE SUB FontFileInfo (FlName$, RetCode%, RetMsg$)
DECLARE SUB FontDirRsrcInfo (FileNum%, FileOffset&)
DECLARE SUB FontRsrcInfo (FileNum%, FilePtr&)
DECLARE SUB RsrcFileInfo (FlName$, RetCode%, RetMsg$)
TYPE FontDirEntryType
FontOrdinal AS INTEGER '...unique ordinal value identifying font
Version AS INTEGER '...version
Size AS LONG '...size of font in bytes
Copyright AS STRING * 60 '...copyright string
FType AS INTEGER '...font type
Pnt AS INTEGER '...point size for optimum display
VertRes AS INTEGER '...vertical resolution in pixels per inch
HorizRes AS INTEGER '...horizontal resolution in pixels per inch
Ascent AS INTEGER '...distance from top of char cell to baseline
IntLeading AS INTEGER '...distance above tops of char's to top of cell
ExtLeading AS INTEGER '...recommended distance above top of cell
Italic AS STRING * 1 '...italic font if equal to 1
Underline AS STRING * 1 '...underlined font if equal to 1
StrikeOut AS STRING * 1 '...strike-out font if equal to 1
Weight AS INTEGER '...relative weight
CharSet AS STRING * 1 '...character set
PixWidth AS INTEGER '...width of character grid in pixels
PixHeight AS INTEGER '...height of character grid in pixels
PitchandFamily AS STRING * 1 '...description of pitch and family
AvgWidth AS INTEGER '...average width
MaxWidth AS INTEGER '...width of widest character
FirstChar AS STRING * 1 '...ASCII value of first char
LastChar AS STRING * 1 '...ASCII value of last char
DefaultChar AS STRING * 1 '...relative char value for out of range chars
BreakChar AS STRING * 1 '...relative char value for word seperator char
WidthBytes AS INTEGER '...number of bytes in each row
Device AS LONG '...offset in bytes to font's device name string
Face AS LONG '...offset in bytes to face name
Reserved AS LONG '...reserved
END TYPE
TYPE FontType
Version AS INTEGER '...version
Size AS LONG '...size of font in bytes
Copyright AS STRING * 60 '...copyright string
FType AS INTEGER '...font type
Pnt AS INTEGER '...point size for optimum display
VertRes AS INTEGER '...vertical resolution in pixels per inch
HorizRes AS INTEGER '...horizontal resolution in pixels per inch
Ascent AS INTEGER '...distance from top of char cell to baseline
IntLeading AS INTEGER '...distance above tops of char's to top of cell
ExtLeading AS INTEGER '...recommended distance above top of cell
Italic AS STRING * 1 '...italic font if equal to 1
Underline AS STRING * 1 '...underlined font if equal to 1
StrikeOut AS STRING * 1 '...strike-out font if equal to 1
Weight AS INTEGER '...relative weight
CharSet AS STRING * 1 '...character set
PixWidth AS INTEGER '...width of character grid in pixels
PixHeight AS INTEGER '...height of character grid in pixels
PitchandFamily AS STRING * 1 '...description of pitch and family
AvgWidth AS INTEGER '...average width
MaxWidth AS INTEGER '...width of widest character
FirstChar AS STRING * 1 '...ASCII value of first char
LastChar AS STRING * 1 '...ASCII value of last char
DefaultChar AS STRING * 1 '...relative char value for out of range chars
BreakChar AS STRING * 1 '...relative char value for word seperator char
WidthBytes AS INTEGER '...number of bytes in each row
Device AS LONG '...offset in bytes to font's device name string
Face AS LONG '...offset in bytes to face name
BitsPointer AS LONG '...unused and set to zero
BitsOffset AS LONG '...offset in bytes to start of bitmap or stroke data
Reserved1 AS STRING * 1 '...reserved
END TYPE
TYPE ExeHdrType
Signature AS STRING * 2 '...MZ for valid EXE code file
ExtraBytes AS INTEGER '...number bytes in last page
Pages AS INTEGER '...number whole & partial pages (512 bytes)
RelocItems AS INTEGER '...number relocation table pointers
HeaderSize AS INTEGER '...number 16 byte paragraphs in header
UnusedHere AS STRING * 50 '...values not needed by this program
WinInfoOffset AS INTEGER '...offset in bytes to WinInfo structure
END TYPE
TYPE WinInfoType
Signature AS STRING * 2 '...NE if valid
UnusedHere1 AS STRING * 34 '...values not needed by this program
ResTabOffset AS INTEGER '...offset to resource table (in bytes relative to WinInfo)
UnusedHere2 AS STRING * 26 '...values not needed by this program
END TYPE
TYPE ResInfoType
TypeID AS INTEGER '...resource type
ResCount AS INTEGER '...number of resources of this type
Reserved AS LONG '...unused
END TYPE
TYPE NameInfoType
Offset AS INTEGER '...offset in alignment units
Length AS INTEGER '...length in bytes of resource
Flags AS INTEGER '...resource flags
ID AS INTEGER '...identifier
Reserved1 AS INTEGER '...unused or reserved
Reserved2 AS INTEGER '...unused or reserved
END TYPE
'...setup a text mode and clear the screen...
SCREEN 0: WIDTH , 50: CLS
PRINT "RSRCINFO.BAS, Unregistered Version 1.0"
PRINT "Routines to display info on resources in a resource file."
PRINT
'...let user enter a resource file name...
INPUT "Enter file type: 1=font (FNT), 2=resource (FON, EXE, DLL)"; FileType%
PRINT
IF (FileType% = 2) THEN
'...let user enter a resource file name...
INPUT "Enter name of resource file (FON, EXE, DLL)"; FlName$
'...get the info from the resource file...
CALL RsrcFileInfo(FlName$, RetCode%, RetMsg$)
ELSE
'...let user enter a resource file name...
INPUT "Enter name of font file (FNT)"; FlName$
'...get the info from the font (FNT) file...
CALL FontFileInfo(FlName$, RetCode%, RetMsg$)
END IF
'...check the return code for a bad resource file...
IF (RetCode% <> 0) THEN
PRINT "***** ERROR: RetCode% = "; RetCode%
PRINT "***** "; RetMsg$
END IF
END
' ************************************************************************
SUB FontDirRsrcInfo (FileNum%, FileOffset&)
' ************************************************************************
DIM FontDirEntry AS FontDirEntryType, OneByte AS STRING * 1
' ...move the file offset into a variable we can destroy...
FilePtr& = FileOffset&
' ...pull the font resource count and increment file ptr...
GET FileNum%, FilePtr&, FrCount%
FilePtr& = FilePtr& + 2
PRINT "Font Dir Resource Count (FrCount): "; FrCount%
FOR i% = 1 TO FrCount%
'...get the next font resource entry...
GET FileNum%, FilePtr&,